package where2go.sctu.com.zhiyou.adpater;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import where2go.sctu.com.zhiyou.R;
import where2go.sctu.com.zhiyou.entity.ClassifyLeft;
import where2go.sctu.com.zhiyou.entity.PersionInfo;

/**
 * ProjectName: zhiyou
 * PackageName: where2go.sctu.com.zhiyou.adpater
 * Created by 张某人
 * CreatedTime:on 2018/5/7   11:45
 * Description:
 */


public class ClassifyAdapter extends BaseAdapter {
    private Context context;

    private List<ClassifyLeft.DataBean> dataList=new ArrayList<ClassifyLeft.DataBean>();
   // private List<PersionInfo> listinfos;


    public ClassifyAdapter(Context context, List<ClassifyLeft.DataBean> dataList) {
        this.context = context;
        this.dataList = dataList;
    }

    @Override
    public int getCount() {
        return dataList.size();
    }

    @Override
    public Object getItem(int position) {
        return dataList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = LayoutInflater.from(context).inflate(R.layout.list_item, null);
        TextView tv = (TextView) convertView.findViewById(R.id.tv);
        ClassifyLeft.DataBean data=dataList.get(position);
        //PersionInfo persionInfo = listinfos.get(position);
        tv.setText(data.getTypeName());
        if (data.isChick()) {
            convertView.setBackgroundResource(R.color.header_blue);
        } else {
            convertView.setBackgroundColor(Color.parseColor("#ffffff"));
        }
        return convertView;
    }
}
